import path from 'path'
import fs from 'fs'
import { fileURLToPath } from 'url'
export function importModel(modelDirName = 'models') {
  let modelDirPath = path.join(import.meta.url,'../../../',modelDirName)
  if (fs.existsSync(fileURLToPath(modelDirPath))) {
    let modelFilePathAll = fs.readdirSync(fileURLToPath(modelDirPath)).filter(item => item.endsWith('.js')).map(item => path.join(modelDirPath,item))
    modelFilePathAll.forEach(item => import(item))    
  }
}